package com.example.mynewsweb.service;

import com.example.mynewsweb.dao.NewDao;
import com.example.mynewsweb.po.New;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
@Service
public class NewServiceImpl implements NewService {
    @Autowired
    private NewDao newDao;

    @Override
    @Transactional(propagation = Propagation.SUPPORTS)
    public List<New> findAll() {
        return newDao.findAll();
    }

    @Override
    public void addNew(New ne) {
        newDao.addNew(ne);
    }

    @Override
    public void addNew2(New ne) {
        newDao.addNew2(ne);
    }

    @Override
    public New findOne(String id) {
        return newDao.findOne(id);
    }

    @Override
    public List<New> findByuserId(String userId) {
        return newDao.findByuserId(userId);
    }

    @Override
    public List<New> findType(String type) {
        return newDao.findType(type);
    }

    @Override
    public void deleteNew(New ne) {
        newDao.deleteNew(ne);
    }

    @Override
    public List<New> findone(String id) {
        return newDao.findone(id);
    }
}
